﻿using Avalonia.Data.Converters;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DaqConfigureTool.Converters
{
    internal class StringToSlotTypeConverter : IValueConverter
    {
        public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
        {
            if(value == null) return string.Empty;
            return value.ToString() switch
            {
                "V" => "电压",
                "C" => "电流",
                "NTC" => "NTC",
                _ => "未知"
            };
        }

        public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
        {
            if (value == null) return string.Empty;
            return value.ToString() switch
            {
                "电压" => "V",
                "电流" => "C",
                "NTC" => "NTC",
                _ => "未知"
            };
        }
    }
}
